import { localize } from '@vee-validate/i18n';
import zh_CN from '@vee-validate/i18n/dist/locale/zh_CN.json';
import { all } from '@vee-validate/rules';
import * as veeValidate from 'vee-validate';
import yup from './yup';

/**
 * 配置校验提示为中文
 */
veeValidate.configure({
  generateMessage: localize('zh_CN', zh_CN),
});

/**
 * 注册所有的校验规则
 */
Object.entries(all).forEach(([name, rule]) => {
  veeValidate.defineRule(name, rule);
});

export { veeValidate, yup };
